package com.ecommerce.dal.entity;
// Generated May 3, 2013 3:35:49 PM by Hibernate Tools 3.6.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Item generated by hbm2java
 */
@Entity
@Table(name = "item")
public class Item implements java.io.Serializable {

	private Long itemId;
	private Client client;
	private Category category;
	private String itemName;
	private Double itemPrice;
	private Double itemDiscount;
	private Double totalItemPrice;
	private Set<ItemHistory> itemHistories = new HashSet<ItemHistory>(0);
	private Set<CustomerItem> customerItems = new HashSet<CustomerItem>(0);
	private Set<ItemDetail> itemDetails = new HashSet<ItemDetail>(0);
	private Set<ItemPhoto> itemPhotos = new HashSet<ItemPhoto>(0);

	public Item() {
	}

	public Item(Client client, Category category, String itemName) {
		this.client = client;
		this.category = category;
		this.itemName = itemName;
	}

	public Item(Client client, Category category, String itemName,
			Double itemPrice, Double itemDiscount, Double totalItemPrice,
			Set<ItemHistory> itemHistories, Set<CustomerItem> customerItems,
			Set<ItemDetail> itemDetails, Set<ItemPhoto> itemPhotos) {
		this.client = client;
		this.category = category;
		this.itemName = itemName;
		this.itemPrice = itemPrice;
		this.itemDiscount = itemDiscount;
		this.totalItemPrice = totalItemPrice;
		this.itemHistories = itemHistories;
		this.customerItems = customerItems;
		this.itemDetails = itemDetails;
		this.itemPhotos = itemPhotos;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ITEM_ID", unique = true, nullable = false)
	public Long getItemId() {
		return this.itemId;
	}

	public void setItemId(Long itemId) {
		this.itemId = itemId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CLIENT_ID", nullable = false)
	public Client getClient() {
		return this.client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CATEGORY_ID", nullable = false)
	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@Column(name = "ITEM_NAME", nullable = false)
	public String getItemName() {
		return this.itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	@Column(name = "ITEM_PRICE", precision = 22, scale = 0)
	public Double getItemPrice() {
		return this.itemPrice;
	}

	public void setItemPrice(Double itemPrice) {
		this.itemPrice = itemPrice;
	}

	@Column(name = "ITEM_DISCOUNT", precision = 22, scale = 0)
	public Double getItemDiscount() {
		return this.itemDiscount;
	}

	public void setItemDiscount(Double itemDiscount) {
		this.itemDiscount = itemDiscount;
	}

	@Column(name = "TOTAL_ITEM_PRICE", precision = 22, scale = 0)
	public Double getTotalItemPrice() {
		return this.totalItemPrice;
	}

	public void setTotalItemPrice(Double totalItemPrice) {
		this.totalItemPrice = totalItemPrice;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "item")
	public Set<ItemHistory> getItemHistories() {
		return this.itemHistories;
	}

	public void setItemHistories(Set<ItemHistory> itemHistories) {
		this.itemHistories = itemHistories;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "item")
	public Set<CustomerItem> getCustomerItems() {
		return this.customerItems;
	}

	public void setCustomerItems(Set<CustomerItem> customerItems) {
		this.customerItems = customerItems;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "item")
	public Set<ItemDetail> getItemDetails() {
		return this.itemDetails;
	}

	public void setItemDetails(Set<ItemDetail> itemDetails) {
		this.itemDetails = itemDetails;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "item")
	public Set<ItemPhoto> getItemPhotos() {
		return this.itemPhotos;
	}

	public void setItemPhotos(Set<ItemPhoto> itemPhotos) {
		this.itemPhotos = itemPhotos;
	}

}
